public class RecursivelyPrintNumbers {
    public static void main(String[] args) {
        System.out.println(fun(1234));
    }

    public static int fun(int n){
        if (n < 10){
            return n;
        }else {
            return (n%10)+fun(n/10);
        }
    }
}
